package com.jsmy.softapp.presenter;

import com.jsmy.softapp.MyApp;
import com.jsmy.softapp.model.SettingModel;
import com.jsmy.softapp.net.API;
import com.jsmy.softapp.util.ToastUtil;
import com.jsmy.softapp.view.SettingView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created with Android Studio.
 * User: wei_cd.
 * Date: 2018/4/28.
 * Time: 16:12.
 * To change for file | settings | file and code templates.
 */

public class SettingPresenter extends BasePresenter<SettingView> {
    public SettingModel model = new SettingModel();

    public void getversioninfo() {
        if (model != null && getView() != null) {
            getView().showLoading();
            Map<String, String> map = new HashMap<>();
            map.put("pvertype", "android");
            model.loadData(API.APP_VERSION_INFO, map, this);
        }
    }
    @Override
    public void onComplete(String type, String code, String msg, Object object) {
        if (getView() != null) {
            switch (code) {
                case "N":
                    break;
                case "Y":
                    getView().showLoadingData(type, object);
                    break;
                default:
                    ToastUtil.showShort(MyApp.getMyApp(), msg);
                    break;
            }
            getView().hideLoading();
        }
    }
}
